//AJAX
//validateUnique
var xmlhttp
function validateUnique(table,field)
{	
xmlhttp=GetXmlHttpObject();
if (xmlhttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  }
var uname = document.getElementById('edUsername').value;

var url="validateUnique.php";
url=url+"?where="+uname;
url=url+"&table="+table;
url=url+"&field="+field;
xmlhttp.onreadystatechange=stateChanged;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}

function stateChanged()
{
if (xmlhttp.readyState==4)
{
  //var my_array = eval(xmlhttp.responseText);
  var error = xmlhttp.responseText;

  if(error=='1')
  {
	  document.getElementById('lblUsernameError').innerHTML = 'This username is not available';
	  document.getElementById('hiddenUserError').value = '1';
  }
  if(error=='0')
  {
	  document.getElementById('lblUsernameError').innerHTML = '';
	  document.getElementById('hiddenUserError').value = '0';
  }
}
}
function GetXmlHttpObject()
{
if (window.XMLHttpRequest)
  {
  return new XMLHttpRequest();
  }
if (window.ActiveXObject)
  {
  return new ActiveXObject("Microsoft.XMLHTTP");
  }
return null;
}